/*
** 2000.c
** 
** Made by (seakage2h)
** Login   <seakage2h@seakage2h-ubuntu>
** 
** Started on  Mon Sep 22 16:36:49 2008 seakage2h
** Last update Sun May 12 01:17:25 2002 Speed Blue
*/

/* #include "2000.h" */
#include <stdio.h>
#include <math.h>

int main()
{
     int day;
     int money;
     int n;

     while(scanf("%d", &day)){
	  if (!day) break;
	  n = floor(sqrt(2 * day));
	  if ( 2 * day > (n+1)*(n+2)) n++;
	  else if ( 2 * day < n * (n+1)) n--; /* possible? */
	  money = n*(n+1)*(2*n+1)/6 + (day - (n+1)*n/2)*(n+1);
	  printf("%d %d\n", day, money);
     }
     return 0;
}

